﻿using carShop.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace carShop.Web.Areas.Admin.Controllers
{
    [RouteArea("Dashboard")]
    public class DashboardController : Controller
    {

        private UnitOfWork uow = new UnitOfWork();
        //
        // GET: /Admin/Dashboard/
        [Authorize]
        public ActionResult Index()
        {
            var user = uow.UserRepository.GetByUsername(User.Identity.Name);
            ViewBag.User = user;
            return View("~/Areas/Admin/Views/Dashboard/Index.cshtml");
        }

        public ActionResult Login()
        {
            if (User.Identity.IsAuthenticated)
            {
                return RedirectToAction("Index");
            }
            return View("~/Areas/Admin/Views/Dashboard/Login.cshtml"); 
        }
    }
}